<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>删除项目</title>
<link href="/css/layout.css" rel="stylesheet" type="text/css" />
<style type="text/css">
li {
	padding: 0px;
	margin: 0px;
	font-size: 14px;
	float: left;
	width: 300px;
}
</style>
</head>

<body>
<div id="wrap">
  <?php 
  	require("../common/pdata_mysql.php");
  	if(isset($_GET['delete']) && $_GET['delete']=="on" && isset($_GET['pid']))
		{
			$sql = "DELETE FROM project WHERE pid = ".$_GET['pid'];
			$conn = mysql_pconnect($hostname_pdata,$username_pdata,$password_pdata);
			mysql_select_db("pdata");
			if($rs = mysql_query($sql,$conn) or die(mysql_error()))
				{ echo "DELETE succeed!"; }
			else
				{ echo "DELETE failed!"; }

			mysql_close($conn);
		}
	?>
	<form method="get">
		<input type="radio" name='delete'  id='delete' />
		<input type='submit' value='删除' />
	<?php
	
	if(isset($_GET['pid']) && !isset($_GET['delete']))
	{	
	$conn = mysql_pconnect($hostname_pdata,$username_pdata,$password_pdata);

	$sql = "SELECT * FROM project WHERE pid = ".$_GET['pid'];
	mysql_select_db("pdata");
	$rs = mysql_query($sql,$conn) or die(mysql_error());
	$row = mysql_fetch_array($rs);
	$maxi = mysql_num_fields($rs);
	echo "<ul>";
	for($i=0;$i<$maxi;$i++)
	{
		$proper = mysql_fetch_field($rs,$i);
		echo "<li>".$proper->name." : ".$row[$i]."</li>";
	}
	echo "</ul>";
	
	echo "<input type='hidden' name='pid' value='".$row[0]."'  />";
	mysql_close($conn);
	}?>
	</form>


</div>
</body>
</html>